home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / asmnamedemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  670 b   |  24 lines

  1. program AsmnameDemo;
  2.  
  3. { Make two variables aliases of each other by using `asmname'.
  4.   This is not good style. If you must have aliases for any reason,
  5.   `absolute' declaration may be the lesser evil... }
  6. var
  7.   Foo: Integer; asmname 'Foo_Bar';
  8.   Bar: Integer; asmname 'Foo_Bar';
  9.  
  10. { A function from the C library }
  11. function PutS (Str: CString): Integer; asmname 'puts'; external;
  12.  
  13. var
  14.   Result: Integer;
  15. begin
  16.   Result := PutS ('Hello World!');
  17.   WriteLn ('puts wrote ', Result, ' characters (including a newline).');
  18.   Foo := 42;
  19.   WriteLn ('Foo = ', Foo);
  20.   Bar := 17;
  21.   WriteLn ('Setting Bar to 17.');
  22.   WriteLn ('Now, Foo = ', Foo, '!!!')
  23. end.
  24.